package com.guanyong.dao;



import com.guanyong.model.UserBaseModel;
import org.apache.ibatis.annotations.*;

import java.util.List;


/**
 * Created by mxk on 2017/3/23.
 * 用户基类
 */
@Mapper
public interface IUserBaseDaoMapper {

    UserBaseModel selectByPrimaryKey(String fId);
    @Select("SELECT * FROM t_ad_userbase "+
            " WHERE f_id in (${idlist})")
    @ResultMap("UserBaseResultMap")
    List<UserBaseModel> selectUserInfoByIdList(@Param("idlist") String idlist);
    //电话查询
    UserBaseModel selectUserByPhone(String phone);
    //邮件查询
    UserBaseModel selectUserByEmail(String email);
    //qq登录
    UserBaseModel selectUserByQqOpenId(String qqOpenid);
    //微博登录
    UserBaseModel selectUserByWeiboOpenId(String weiboOpenid);
    //威信登录
    UserBaseModel selectUserByWechatOpenId(String wechatOpenid);

    int deleteByPrimaryKey(String fId);

    int updateByPrimaryKeySelective(@Param(value = "record") UserBaseModel record);


    @Update("update t_ad_userbase set f_qqopenid=null"+
            " WHERE f_id=#{fid}")
    int upNullQqopenid(@Param(value = "fid") String fId);

    @Update("update t_ad_userbase set f_wechatopenid=null"+
            " WHERE f_id=#{fid}")
    int upNullWechatopenid(@Param(value = "fid") String fId);

    @Update("update t_ad_userbase set f_weibopenid=null"+
            " WHERE f_id=#{fid}")
    int upNullWeibopenid(@Param(value = "fid") String fId);

    int insert(UserBaseModel record);


    List<UserBaseModel> SelectUserBaseList(@Param("userBase")UserBaseModel userBase,
                                       @Param("offset")Integer offset,
                                       @Param("limit") Integer limit);

    Integer SelectUserBaseListCount(@Param("userBase")UserBaseModel userBaseModel);

}
